<template>
	<view class="question-page">
		<view class="question-page-content">
			<view class="page-content-top">
				<view class="content-top-left">
					<img :src="question?.avatar?.url?question?.avatar?.url:queryIconImage('modelone1') " alt=""
						class="top-left-img">
				</view>
				<view class="content-top-right">
					<view class="top-right-top">
						<view class="right-top-title">
							<span>{{question?.nickname}}</span>
							<img :src="queryIconImage('cardlogo1')" alt="" class="top-title-img">
						</view>
						<view class="right-top-text">
							<span class="top-text">关注 &nbsp;45</span>
							<span>粉丝 &nbsp;223</span>

						</view>
					</view>
					<view class="top-right-bottom">
						<view class="right-bottom-left">
							<view class="bottom-left-title">
								<span>{{question?.profile}}</span>
							</view>
							<view class="bottom-left-bottom">
								<span class="left-bottom-lefttext">30天获赞66</span>
								<span class="left-bottom-righttext">56会打</span>
							</view>
						</view>
						<view class="bottom-left-btn" @click="askquestionBtn(11111)">
							<span>提问</span>
						</view>
					</view>
				</view>
			</view>
			<view class="page-content-bottom">
				<span class="content-bottom-title">专业标签:</span>
				<span class="content-bottom-text" v-for="(v,i) in question.attach_data" :key="v">{{v?.label}}</span>
			</view>
		</view>
	</view>
</template>

<script>
	import methods from "@/pages/home/methods.js"
	import {
		mapState
	} from 'vuex'
	export default {
		name: "questionCard",
		props: {
			question: {
				type: Object,
				default: () => {}
			}
		},
		data() {
			return {

			};
		},
		computed: {
			...mapState({
				headericon: state => state.remote?.headericon?.data_list ?? [],
			})
		},
		mounted() {
			this.querySections()
		},
		methods: {
			...methods,
			queryIconImage(label, key = "headericon") {
				return this[key]?.find(res => res?.label == label)?.img?.url;
			},
			askquestionBtn(data) {
				this.stri = JSON.stringify(this.question)
				// console.log("接收的数据", this.stri);
				getApp().val = this.stri
				uni.switchTab({
					url: `/pages/question/question`
				})
				this.$emit("askquestionBtn", data)
			}
		}
	}
</script>

<style lang="scss">
	.question-page {
		width: 100%;
		background-color: #fff;
		box-sizing: border-box;
		padding: 20rpx 21rpx 35rpx 30rpx;
		border-radius: 15rpx 15rpx 15rpx 15rpx;
		z-index: 99999;
		margin-bottom: 20rpx;

		.question-page-content {
			width: 100%;

			.page-content-top {
				display: flex;

				width: 100%;

				.content-top-left {
					width: 120rpx;
					height: 120rpx;
					border-radius: 50%;
					overflow: hidden;
					display: flex;
					justify-content: center;
					align-items: center;
					margin-right: 30rpx;

					.top-left-img {
						width: 120rpx;
						height: 120rpx;
						border-radius: 50%;
					}

				}

				.content-top-right {
					flex: 1;
					margin-bottom: 30rpx;

					.top-right-top {
						display: flex;
						justify-content: space-between;

						.right-top-title {
							font-size: 32rpx;
							font-family: Source Han Sans CN-Bold, Source Han Sans CN;
							font-weight: 700;
							color: #3D3D3D;
							line-height: 42rpx;

							.top-title-img {
								width: 30rpx;
								height: 30rpx;
								margin-left: 10rpx;
							}
						}

						.right-top-text {
							font-size: 24rpx;
							font-family: Alibaba PuHuiTi 2.0-55 Regular, Alibaba PuHuiTi 20;
							font-weight: 400;
							color: #999999;
							line-height: 40rpx;

							.top-text {
								margin-right: 20rpx;
							}
						}
					}

					.top-right-bottom {
						display: flex;
						justify-content: space-between;
						align-items: center;

						.right-bottom-left {
							width: 70%;

							.bottom-left-title {
								width: 90%;
								font-size: 30rpx;
								font-family: Source Han Sans CN-Medium, Source Han Sans CN;
								font-weight: 500;
								color: #999999;
								line-height: 43rpx;
								overflow: hidden;
								text-overflow: ellipsis;
								display: -webkit-box;
								-webkit-line-clamp: 2;
								-webkit-box-orient: vertical;
							}

							.bottom-left-bottom {
								font-size: 24rpx;
								font-family: Source Han Sans CN-Medium, Source Han Sans CN;
								font-weight: 500;
								line-height: 35rpx;

								.left-bottom-lefttext {
									display: inline-block;
									padding: 5rpx 10rpx;
									background-color: #FFE6B8;
									border-radius: 10rpx;
									text-align: center;
									color: #F09500;
									margin-right: 20rpx;
									margin-top: 20rpx;

								}

								.left-bottom-righttext {
									display: inline-block;
									padding: 5rpx 10rpx;
									background-color: #EEEEEE;
									border-radius: 10rpx;
									text-align: center;
									color: #5F5F5F;
								}
							}
						}

						.bottom-left-btn {
							width: 160rpx;
							height: 80rpx;
							background: #F09500;
							border-radius: 50rpx 50rpx 50rpx 50rpx;
							text-align: center;
							font-size: 30rpx;
							font-family: Source Han Sans CN-Bold, Source Han Sans CN;
							font-weight: 700;
							color: #FFFFFF;
							line-height: 80rpx;
						}
					}
				}

			}

			.page-content-bottom {
				font-size: 24rpx;
				font-family: Source Han Sans CN-Medium, Source Han Sans CN;
				font-weight: 500;
				color: #999999;
				line-height: 35rpx;

				.content-bottom-title {
					margin-right: 30rpx;

				}

				.content-bottom-text {
					font-size: 24rpx;
					font-family: Source Han Sans CN-Medium, Source Han Sans CN;
					font-weight: 500;
					color: #F09500;
					line-height: 35rpx;
					border-bottom: 2rpx solid #F09500;
					margin-right: 15rpx;
				}

			}
		}
	}
</style>